import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) {
  return originalPush.call(this, location).catch(err => { })
};//重复点击路由不会报错
Vue.use(VueRouter)


const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path:'/login',
    component:()=>import('../components/login.vue')
  }
  ,{
    path:'/user',
    component:()=>import('../components/user.vue')
  },
  {
  path:'/userInfo',
  component:()=>import('../components/userInfo.vue')
  },{
    path:'/custmerList',
    component:()=>import('../components/custmer/custmerList.vue')
  },{
    path:'/custDetail',
    component:()=>import('../components/custmer/custDetail.vue')
  },
  {
    path:'/custmer/:id',
    component:()=>import('../components/custmer/custmer.vue'),
    children:[
      {
        path:'/income',
        name:'income',
        component:()=>import('../components/custmer/income.vue')
       },
       {
        path:'/enterprise',
        name:'enterprise',
        component:()=>import('../components/custmer/enterprise.vue')
       },
       {
        path:'/partners',
        name:'partners',
        component:()=>import('../components/custmer/partners.vue')
       },
       {
        path:'/incomeYear',
        name:'incomeYear',
        component:()=>import('../components/custmer/incomeYear.vue')
       },
    ]
  },{
    path:'/custmerDetail/:id',
    component:()=>import('../components/custmer/custmerDetail.vue')
  },
  {
    path:'/cust',
    component:()=>import('../components/cust/cust.vue')
  },
  {
    path:'/addvisit',
    component:()=>import('../components/cust/addvisit.vue')
  },
  {
    path:'/customer',
    component:()=>import('../components/cust/customer.vue'),
   
  },{
    path:'/detail/:id',
    name:'detail',
    component:()=>import('../components/cust/detail.vue')
  },{
       path:'/star',
       component:()=>import('../components/star/star.vue')
  },
  {
    path:'/star/evaluate/:id/:val',
    name:'/star/evaluate',
    component:()=>import('../components/star/evaluate.vue')
},
{
  path:'/evaluateInfo/:id',
  name:'evaInfo',
  component:()=>import('../components/star/evaluateInfo.vue')
},
  {
    path:'/dilivery',
    component:()=>import('../components/dilivery/dilivery.vue'),
    children:[
      {
        path:'/dilivery/all',
        component:()=>import('../components/dilivery/all.vue')
       },
       {
        path:'/dilivery/paddingDilivery',
        component:()=>import('../components/dilivery/paddingDiliver.vue')
       },
       {
        path:'/dilivery/paddingReceive',
        component:()=>import('../components/dilivery/paddingReceive.vue')
       },
       {
        path:'/dilivery/comment',
        component:()=>import('../components/dilivery/comment.vue')
       }
    ]
  },
  {
    path:'/send/:id',
    name:'send',
    component:()=>import('../components/dilivery/send.vue')
  },{
    path:'/evaluate/:id',
    name:'evaluate',
    component:()=>import('../components/dilivery/evaluate.vue')
  },
  {
    path:'/evaluateInfo/:id',
    name:'evaluateInfo',
    component:()=>import('../components/dilivery/evaluateInfo.vue')
  },
  {
    path:'/message',
    name:'message',
    component:()=>import('../components/message/message.vue'),
    children:[{
      path:'/message/all',
      component:()=>import('../components/message/messageAll.vue')
    },{
      path:'/message/system',
      component:()=>import('../components/message/messageSystem.vue')
    },{
      path:'/message/user',
      component:()=>import('../components/message/messageUser.vue')
    }]
  },
  {
    path:'/detailMessage',
    name:'detailMessage',
    component:()=>import('../components/message/detail.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
